<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>纯CSS绘制三角形</title>
  <style>
    .triangle1 {
      width: 0;
      height: 0;
      border-width: 20px;
      border-style: solid;
      border-color: green greenyellow blue pink;

      /*border-bottom-width: 0px;*/
      border-left-width: 0px;
    }

    .triangle2 {
      width: 0;
      height: 0;
      border-width: 20px 20px 20px 20px;
      border-style: solid;
      border-color: green transparent transparent transparent;
    }


    .box {
      overflow: hidden;
    }
    .triangle3 {
      width: 0;
      height: 0;
      border-color: transparent red transparent transparent;
      border-style: solid;
      border-width: 22px 8px 0 0;
      float: left;
    }
    .triangle4 {
      height: 22px;
      width: 100px;
      background: red;
      float: left;
    }
  </style>
</head>

<body>
<div class="triangle1"></div>

<hr>
<div class="triangle2"></div>

<hr>
<div clas="box">
  <div class="triangle3"></div>
  <div class="triangle4"></div>
</div>
</body>

</html>
